/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Controller;

import java.io.Serializable;
import java.util.Collection;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

/**
 *
 * @author gulben
 */
@Entity
@Table(name = "Artists")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Artists.findAll", query = "SELECT a FROM Artists a"),
    @NamedQuery(name = "Artists.findById", query = "SELECT a FROM Artists a WHERE a.id = :id"),
    @NamedQuery(name = "Artists.findByName", query = "SELECT a FROM Artists a WHERE a.name = :name"),
    @NamedQuery(name = "Artists.findBySurname", query = "SELECT a FROM Artists a WHERE a.surname = :surname"),
    @NamedQuery(name = "Artists.findByImage", query = "SELECT a FROM Artists a WHERE a.image = :image"),
    @NamedQuery(name = "Artists.findByDescription", query = "SELECT a FROM Artists a WHERE a.description = :description")})
public class Artists implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "ID")
    private Integer id;
    @Size(max = 50)
    @Column(name = "Name")
    private String name;
    @Size(max = 50)
    @Column(name = "Surname")
    private String surname;
    @Size(max = 2147483647)
    @Column(name = "Image")
    private String image;
    @Size(max = 2147483647)
    @Column(name = "Description")
    private String description;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "artistID")
    private Collection<ArtistProductMappings> artistProductMappingsCollection;

    public Artists() {
    }

    public Artists(Integer id) {
        this.id = id;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSurname() {
        return surname;
    }

    public void setSurname(String surname) {
        this.surname = surname;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    @XmlTransient
    public Collection<ArtistProductMappings> getArtistProductMappingsCollection() {
        return artistProductMappingsCollection;
    }

    public void setArtistProductMappingsCollection(Collection<ArtistProductMappings> artistProductMappingsCollection) {
        this.artistProductMappingsCollection = artistProductMappingsCollection;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Artists)) {
            return false;
        }
        Artists other = (Artists) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "Controller.Artists[ id=" + id + " ]";
    }
    
}
